// EMERGENT GAME TECHNOLOGIES PROPRIETARY INFORMATION
//
// This software is supplied under the terms of a license agreement or
// nondisclosure agreement with Emergent Game Technologies and may not 
// be copied or disclosed except in accordance with the terms of that 
// agreement.
//
//      Copyright (c) 1996-2008 Emergent Game Technologies.
//      All Rights Reserved.
//
// Emergent Game Technologies, Chapel Hill, North Carolina 27517
// http://www.emergent.net

#ifndef NITSTRINGMAP_H
#define NITSTRINGMAP_H

#include "GnTMap.h"
#include "GnTPointerMap.h"

// The hash function class
class GnStringHashFunctor
{
public:
    static unsigned int KeyToHashIndex(const char* pcKey,
        unsigned int uiTableSize);
};

// The equality function class
class GnStringEqualsFunctor
{
public:
    static bool IsKeysEqual(const char* pcKey1, const char* pcKey2);
};

template <class TPARENT, class TVAL,
    class THASH = GnStringHashFunctor,
    class TEQUALS = GnStringEqualsFunctor > class GnTStringTemplateMap :
    public TPARENT
{
public:
    // construction and destruction
    GnTStringTemplateMap(unsigned int uiHashSize = 37, bool bCopy = true);
    virtual ~GnTStringTemplateMap();

protected:
    virtual void SetValue(GnTMapItem<const char*, TVAL>* pkItem,
        const char* pcKey, TVAL val);
    virtual void ClearValue(GnTMapItem<const char*, TVAL>* pkItem);

    bool m_bCopy;
};

template <class TVAL,
    class THASH = GnStringHashFunctor,
    class TEQUALS = GnStringEqualsFunctor > class GnTStringMap :
    public GnTStringTemplateMap<GnTMap<const char*, TVAL, THASH, TEQUALS>,
    TVAL>
{
public:
    GnTStringMap(unsigned int uiHashSize = 37, bool bCopy = true);
};

template <class TVAL,
    class THASH = GnStringHashFunctor,
    class TEQUALS = GnStringEqualsFunctor > class GnTStringPointerMap :
    public GnTStringTemplateMap
    <GnTPointerMap<const char*, TVAL, THASH, TEQUALS>, TVAL>
{
public:
    GnTStringPointerMap(unsigned int uiHashSize = 37, bool bCopy = true);
};

#include "GnTStringMap.inl"


#endif // NITSTRINGMAP_H
